package org.calconnect.icalproofing;

/**
 *	<p>URLUtils class</p>
 *
 *	<p>Utility class to manipulate URLs.</p>
 *
 *	<p><em>Last checked in by: $Author: aron $ at $Date: 2008-10-23 15:23:16 -0700 (Thu, 23 Oct 2008) $ (UTC)</em></p>
 *
 *	@author Aron Roberts
 *	@version $Revision: 504 $
 */
 
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.log4j.Logger;

public final class URLUtils {

	// Class variables

	// Get the name of this class
	final static String CLASSNAME = "URLUtils";

	// Create a log4j 'logger' for this class, based on the class name
  //
  // This allows us to identify which log events are coming from the
  // methods of this class
	public static Logger logger = Logger.getLogger( CLASSNAME );

 	/////////////////////////////////////////////////////////////////
	/**
	 *	Returns a URL from a string representing a URL.
	 *
	 *	@param		urlstring		A string representing a URL.
	 *
	 *	@return 	A URL representation of the string
	 */
	public static URL urlFromString( String urlstring ) throws MalformedURLException {

		logger.debug( "In urlFromString() in class " + CLASSNAME + "...");
		 
		URL url = null;
  	try {
 			url = new URL( urlstring );
 		} catch ( MalformedURLException e ) {
  		throw e;
 		}
 		
 		return url;
 		
 	}

	/////////////////////////////////////////////////////////////////

  public static void main( String[] args ) {

		// Display descriptive information about this class

  	System.out.println( CLASSNAME );
  	System.out.println( "$Revision: 504 $" );
  	System.out.println( "$Date: 2008-10-23 15:23:16 -0700 (Thu, 23 Oct 2008) $" );
	
	}
	
}